﻿namespace Web.Controllers
{
    using System.Collections.Generic;
    using System.Web.Mvc;

    using Witcraft.Halcyone.ASPFacility;

    /// <summary>
    /// 
    /// </summary>
    [RestService]
    public class FooServiceController : Controller
    {
        [HttpPost]
        public ActionResult OperatoionWithComplexInputParameter(FooParameter param)
        {
            // Some logic
            return this.Json(123);
        }

        [HttpPost]
        public ActionResult OperatoionWithComplexInputParameterSendedViaRequestStream([RequestParameter] FooParameter param)
        {
            // Some logic
            return this.Json(123);
        }

        [HttpPost]
        public ActionResult OperatoionWithPrimitiveInputParameter(int param)
        {
            // Some logic
            return this.Json(123);
        }

        [HttpPost]
        public ActionResult OperatoionWithArrayParameter(IEnumerable<int> param)
        {
            // Some logic
            return this.Json(123);
        }

        [HttpPost]
        public ActionResult OperationWithComplexResponse()
        {
            // Some logic
            return this.Json(new FooParameter
                {
                    Name = "Apple",
                    Price = 300
                });
        }
    }

    public class FooParameter
    {
        public string Name { get; set; }

        public int Price { get; set; }
    }
}